#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
struct Point {
  int x, y;
  bool operator<(const Point& p) const { return x == p.x ? y < p.y : x < p.x; }
  bool operator!=(const Point& p) const { return x != p.x || y != p.y; }
  bool operator==(const Point& p) const { return x == p.x && y == p.y; }
} a[10];
struct Line {
  Point p1, p2;
  bool operator<(const Line& o) const {
    return p1 == o.p1 ? p2 < o.p2 : p1 < o.p1;
  }
  bool operator!=(const Line& o) const { return p1 != o.p1 || p2 != o.p2; }
  bool operator==(const Line& o) const { return p1 == o.p1 && p2 == o.p2; }
} b[10], c[10];

bool solve() {
  rep(i, 1, 4) {
    cin >> b[i].p1.x >> b[i].p1.y;
    cin >> b[i].p2.x >> b[i].p2.y;
    if (b[i].p2 < b[i].p1) swap(b[i].p1, b[i].p2);
  }
  int xmn = 1e9, xmx = -1e9, ymn = 1e9, ymx = -1e9;
  rep(i, 1, 4) {
    xmn = min({xmn, b[i].p1.x, b[i].p2.x});
    xmx = max({xmx, b[i].p1.x, b[i].p2.x});
    ymn = min({ymn, b[i].p1.y, b[i].p2.y});
    ymx = max({ymx, b[i].p1.y, b[i].p2.y});
  }
  if (xmn == xmx || ymn == ymx) return false;
  a[1] = {xmn, ymn}, a[2] = {xmn, ymx}, a[3] = {xmx, ymn}, a[4] = {xmx, ymx};
  c[1] = {a[1], a[2]}, c[2] = {a[1], a[3]};
  c[3] = {a[2], a[4]}, c[4] = {a[3], a[4]};
  sort(b + 1, b + 5);
  rep(i, 1, 4) if (b[i] != c[i]) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) cout << (solve() ? "YES" : "NO");
  return 0;
}